import http from "@/utils/http"

/**
 * @description 商品详情加入购物车，购物车更新商品数量
 * @param {Object} param {goodsId,count,blessing}
 * @returns Promise
 */
export const reqAddCart = ({
  goodsId,
  count,
  ...data
}) => {
  return http.get(`/cart/addToCart/${goodsId}/${count}`, data)
}

/**
 * @description 获取购物车列表数据
 * @returns Promise
 */
export const reqCartList = () => {
  return http.get("/cart/getCartList")
}


/**
 * @description 更新商品选中状态
 * @param {*} goodsId 商品id
 * @param {*} isChecked 商品选中状态
 * @returns Promise
 */
export const reqUpdateChecked = (goodsId, isChecked) => {
  return http.get(`/cart/checkCart/${goodsId}/${isChecked}`)
}


/**
 * @description 全选或全不选购物车商品
 * @param {*} isChecked 购物车商品全选状态
 * @returns Promise
 */
export const reqCheckAllStatus = (isChecked) => {
  return http.get(`/cart/checkAllCart/${isChecked}`)
}


/**
 * @description 删除购物车商品
 * @param {*} goodsId 商品id
 * @returns Promise
 */
export const reqDelCartGoods = (goodsId) => {
  return http.get(`/cart/delete/${goodsId}`)
}